local M = {}

local MAX_DIZHU_RATE_SELECT_ONE = 32
local MAX_DIZHU_RATE_SELECT_TWO = 64
local MAX_DIZHU_RATE_SELECT_THRE = 128

local FRIENT_TABLE_COUNT_SELECT_ONE = 6
local FRIENT_TABLE_COUNT_SELECT_TWO = 9
local FRIENT_TABLE_COUNT_SELECT_THREE = 15

local NORMAL_TABLE_TYPE_NEW_ZHAJINHUA = 100  --经典新手场

-- local NORMAL_TABLE_TYPE_BRNN = 200  --百人牛牛新手场

local FRIEND_TABLE_TYPE_NORMAL = 201 --好友经典房
local FRIEND_TABLE_TYPE_LAIZI = 202  --好友癞子房

local FRIEND_TABLE_TYPE_XUEZHAN   = 10001 --血战到底好友房

----------------------------------------------------------------------------------------------------------

local SET_DIZHU_WAY_ROB = 1
local SET_DIZHU_WAY_SCORE = 2

-------------------------------------------------游戏类型-------------------------------------------------
local GAME_TYPE_ZJH 							= 1 --炸金花
local GAME_TYPE_KPQZ_NN                     	= 2 --看牌抢庄牛牛
local GAME_TYPE_DDZ_NORMAL        				= 3 --斗地主金币场(普通玩法)
local GAME_TYPE_DDZ_LAIZI						= 4 --斗地主癞子玩法
local GAME_TYPE_FISHING							= 6 --捕鱼

-- local GAME_TYPE_CLUB_FRIEND_ZJH 				= 100009
-- local GAME_TYPE_CLUB_FRIEND_CZJH 			= 100010
-- local GAME_TYPE_CLUB_FRIEND_RZJH 			= 100011

local GAME_TYPE_FRIEND_ZJH_ONE 					= 100000
local GAME_TYPE_FRIEND_ZJH_TWO 					= 100001
local GAME_TYPE_FRIEND_ZJH_THREE 				= 100002
local GAME_TYPE_FRIEND_ZJH_FOUR 				= 100003

local GAME_TYPE_FRIEND_KPQZ_ONE 				= 100010
local GAME_TYPE_FRIEND_KPQZ_TWO 				= 100011
local GAME_TYPE_FRIEND_KPQZ_THREE 				= 100012
local GAME_TYPE_FRIEND_KPQZ_FOUR 				= 100013

local GAME_TYPE_ORDINARY_ROOM_NN            	= 100100 --俱乐部好友房


local GAME_TYPE_HONGHEIDAZHAN_ZJH 			= 2000 --红黑大战
local GAME_TYPE_BR_NN             			= 2001 --百人牛牛
local GAME_TYPE_TEN_BR_NN       			= 2002 --十倍百人牛牛
local GAME_TYPE_LFDJ         				= 2003 --龙凤对决
local GAME_TYPE_TIGER						= 2004 -- 老虎机
local GAME_TYPE_BCBM						= 2005 --奔驰宝马
local GAME_TYPE_BAIJIALE					= 2006 --百家乐
local GAME_TYPE_ERBAGANG					= 2007 --二八杠

local GAME_TYPE_HONGBAO						= 2008 --红包
local GAME_TYPE_SHISUN						= 2009 --视讯游戏


----------------------------------------------------------------------------------------------------------

local IS_TABLE_RANDOM = true --该标记开启的话表示从所有的桌子节点中进行随机房间服务 如果该标记为false 那么下面的table_svr_router起路由节点作用

-- M.table_svr_router = {
-- 	--炸金花部署1号桌子节点
-- 	[GAME_TYPE_ZJH] = 1, --1表示1号桌子节点
-- 	[GAME_TYPE_FRIEND_ZJH] = 1,
-- 	[GAME_TYPE_CLUB_FRIEND_ZJH] = 1,
-- 	[GAME_TYPE_CLUB_FRIEND_CZJH] = 1,
-- 	[GAME_TYPE_CLUB_FRIEND_RZJH] = 1,
-- 	[GAME_TYPE_HONGHEIDAZHAN_ZJH] = 1,

-- 	--牛牛部署2号桌子节点
-- 	[GAME_TYPE_KPQZ_NN] = 1, --2表示2号桌子节点
-- 	[GAME_TYPE_BR_NN]   = 1,
-- 	[GAME_TYPE_ORDINARY_ROOM_NN] = 1,
-- }

--游戏类型人数映射
M.game_player_num = {
	[GAME_TYPE_ZJH] = 5,
	[GAME_TYPE_HONGHEIDAZHAN_ZJH] 	= 300,
	[GAME_TYPE_BR_NN]             	= 300,
	[GAME_TYPE_KPQZ_NN]           	= 5,
	[GAME_TYPE_DDZ_NORMAL]        	= 3,
	[GAME_TYPE_LFDJ]             	= 300,
	[GAME_TYPE_TIGER]             	= 1,
	[GAME_TYPE_FISHING]          	= 4,
	[GAME_TYPE_TEN_BR_NN]			= 300,
	[GAME_TYPE_BCBM]				= 300,
	[GAME_TYPE_FRIEND_ZJH_ONE]   	= 5,
	[GAME_TYPE_FRIEND_ZJH_TWO]   	= 5,
	[GAME_TYPE_FRIEND_ZJH_THREE] 	= 5,
	[GAME_TYPE_FRIEND_ZJH_FOUR]  	= 5,
	[GAME_TYPE_FRIEND_KPQZ_ONE]   	= 5,
	[GAME_TYPE_FRIEND_KPQZ_TWO]   	= 5,
	[GAME_TYPE_FRIEND_KPQZ_THREE] 	= 5,
	[GAME_TYPE_FRIEND_KPQZ_FOUR]  	= 5,
	[GAME_TYPE_ORDINARY_ROOM_NN] 	= 5,
	[GAME_TYPE_BAIJIALE]			= 300,
	[GAME_TYPE_HONGBAO]			= 300,
	[GAME_TYPE_ERBAGANG]			= 300,
}

M.in_game_type = {
	[GAME_TYPE_TIGER] = 1,
}

M.set_dizhu_way = {
	[SET_DIZHU_WAY_ROB] = true,
	[SET_DIZHU_WAY_SCORE] = true,
}


local ddz_ftable_map = {
	[FRIEND_TABLE_TYPE_NORMAL] = true,
	[FRIEND_TABLE_TYPE_LAIZI] = true,
}

M.ddz_ftable_map = ddz_ftable_map

local xuezhan_ftable_map = {
	[FRIEND_TABLE_TYPE_XUEZHAN] = true,
}
M.xuezhan_ftable_map = xuezhan_ftable_map

-----------------------------------------------炸金花相关配置变量-----------------------------------------------
--私人房炸金花
local zhajinghua_ftable_map = {
	-- [GAME_TYPE_FRIEND_ZJH] = true,
	-- [GAME_TYPE_CLUB_FRIEND_ZJH] = true,
	-- [GAME_TYPE_CLUB_FRIEND_CZJH] = true,
	--[GAME_TYPE_CLUB_FRIEND_RZJH] = true,
}
M.zhajinghua_ftable_map = zhajinghua_ftable_map

local nn_ftable_map = {
	[GAME_TYPE_ORDINARY_ROOM_NN] = true,
}

M.nn_ftable_map = nn_ftable_map
-----------------------------------------------------------------------------------------------------------------

local server_name_map = {
	[GAME_TYPE_ZJH] 						= 'coin_zjhtable',    --经典新手场
	[GAME_TYPE_FRIEND_ZJH_ONE]   			= 'friend_zjhtable',  --炸金花俱乐部好友房
	[GAME_TYPE_ORDINARY_ROOM_NN]            = "friend_kpqztable", --牛牛俱乐部好友房
	
	[GAME_TYPE_HONGHEIDAZHAN_ZJH] 			= 'hhdz_zjhtable',	--红黑大战
	--[GAME_TYPE_CLUB_FRIEND_ZJH] 			= 'cfriend_zjhtable',	--俱乐部
	--[GAME_TYPE_CLUB_FRIEND_CZJH] 			= 'ccoin_zjhtable',	--俱乐部
	--[GAME_TYPE_CLUB_FRIEND_RZJH] 			= 'ccoin_zjhtable',	--俱乐部
	[GAME_TYPE_BR_NN] 			            = 'br_nntable',	        --百人牛牛
	[GAME_TYPE_KPQZ_NN] 			        = 'kpqz_nntable',	    --看牌抢庄牛牛
	[GAME_TYPE_DDZ_NORMAL]                  = 'ddztable',				--斗地主
	[GAME_TYPE_LFDJ] 						= 'lfdj_lfdjtable',	    --龙凤对决
	[GAME_TYPE_TIGER]						= 'tiger_tigertable',   --老虎机
	[GAME_TYPE_FISHING]						= 'fishing_table',
	[GAME_TYPE_TEN_BR_NN]					= 'br_nntable',			--百人牛牛十倍场
	[GAME_TYPE_BCBM]						= 'bcbm_table',			--奔驰宝马
	[GAME_TYPE_BAIJIALE]					= 'baijiale/baijiale_service',	--百家乐
	[GAME_TYPE_HONGBAO]						= 'hbsl/hbsl_service',	     --红包扫雷
	[GAME_TYPE_ERBAGANG]					= 'erbagang/erbagang_service',	--二八杠
}

M.server_name_map = server_name_map

M.max_dizhu_rate = {
	[MAX_DIZHU_RATE_SELECT_ONE] = true,
	[MAX_DIZHU_RATE_SELECT_TWO] = true,
	[MAX_DIZHU_RATE_SELECT_THRE] = true,
}

M.count_select = {
	[FRIENT_TABLE_COUNT_SELECT_ONE] = true,
	[FRIENT_TABLE_COUNT_SELECT_TWO] = true,
	[FRIENT_TABLE_COUNT_SELECT_THREE] = true,
}


-----------------------------------匹配规则----------------------------------
local match_types = {
    LEGACY_COMMON  = 1,
    LEGACY_SPECIAL = 2,
    NEW_COMMON     = 3,       --百人场
    NEW_SPECIAL    = 4,
    HBSL           = 5,     --红包扫雷模式 玩家进入时创建后一直存在
}
M.match_types = match_types

M.match_config = {
	[GAME_TYPE_DDZ_NORMAL]        = match_types.LEGACY_COMMON,
	[GAME_TYPE_ZJH]               = match_types.NEW_SPECIAL,
	[GAME_TYPE_HONGHEIDAZHAN_ZJH] = match_types.NEW_COMMON,
	[GAME_TYPE_BR_NN]             = match_types.NEW_COMMON,
	[GAME_TYPE_KPQZ_NN]           = match_types.NEW_SPECIAL,
	[GAME_TYPE_LFDJ]              = match_types.NEW_COMMON,
	[GAME_TYPE_TIGER]             = match_types.NEW_SPECIAL,
	[GAME_TYPE_FISHING]           = match_types.NEW_SPECIAL,
	[GAME_TYPE_TEN_BR_NN]		  = match_types.NEW_COMMON,
	[GAME_TYPE_BCBM]			  = match_types.NEW_COMMON,
	[GAME_TYPE_BAIJIALE]		  = match_types.NEW_COMMON,
	[GAME_TYPE_HONGBAO]		  	  = match_types.HBSL,
	[GAME_TYPE_ERBAGANG]		  = match_types.NEW_COMMON,
}

local function values_to_keys(t)
	local nt = {}
	for _,v in pairs(t) do
		nt[v] = true
	end
	return nt
end
local table_type_list = {
	NORMAL_TABLE_TYPE_NEW_ZHAJINHUA,

	FRIEND_TABLE_TYPE_LAIZI,
	BAIREN_TABLE_TYPE_HONGHEIDAZHAN,
}

M.table_type_list = table_type_list
M.table_type_map = values_to_keys(table_type_list)

local friend_table_type_list = {
	FRIEND_TABLE_TYPE_NORMAL,
	FRIEND_TABLE_TYPE_LAIZI
}
M.friend_table_type_list = friend_table_type_list
M.friend_table_type_map = values_to_keys(friend_table_type_list)

local friend_lztable_type_list = {
	FRIEND_TABLE_TYPE_LAIZI,
}
M.friend_lztable_type_list = friend_lztable_type_list
M.friend_lztable_type_map = values_to_keys(friend_lztable_type_list)

local laizi_table_type_list = {
	LAIZI_TABLE_TYPE_NEW,
	LAIZI_TABLE_TYPE_BASE,
	LAIZI_TABLE_TYPE_LOW,
	LAIZI_TABLE_TYPE_MIN,
	LAIZI_TABLE_TYPE_HIGHT,
	LAIZI_TABLE_TYPE_ZHIZUN,
}
M.laizi_table_type_list = laizi_table_type_list
M.laizi_table_type_map = values_to_keys(laizi_table_type_list)

local XUEZHAN_FTABLE_COUNT_SELECT_ONE = 4
local XUEZHAN_FTABLE_COUNT_SELECT_TWO = 8
M.xuezhan_count_map = {
	[XUEZHAN_FTABLE_COUNT_SELECT_ONE] = true,
	[XUEZHAN_FTABLE_COUNT_SELECT_TWO] = true,
}

local XUEZHAN_LIMIT_RATE_SELECT_ONE = 2
local XUEZHAN_LIMIT_RATE_SELECT_TWO = 3
local XUEZHAN_LIMIT_RATE_SELECT_THREE = 4
M.xuezhan_limit_rate_map = {
	[XUEZHAN_LIMIT_RATE_SELECT_ONE] = true,
	[XUEZHAN_LIMIT_RATE_SELECT_ONE] = true,
	[XUEZHAN_LIMIT_RATE_SELECT_THREE] = true,
}

local XEUZHAN_ZIMO_SELECT_ONE = 1
local XEUZHAN_ZIMO_SELECT_TWO = 2
M.xuezhan_zimo_map = {
	[XEUZHAN_ZIMO_SELECT_ONE] = true,
	[XEUZHAN_ZIMO_SELECT_TWO] = true,
}

local XEUZHAN_DIANGANGHUA_ADDTION_SELECT_ONE = 1
local XEUZHAN_DIANGANGHUA_ADDTION_SELECT_TWO = 2
M.dianganghua_map = {
	[XEUZHAN_DIANGANGHUA_ADDTION_SELECT_ONE] = true,
	[XEUZHAN_DIANGANGHUA_ADDTION_SELECT_ONE] = true,
}

local XUEZHAN_PLAY_SELECT_MAX_COUNT = 4
M.XUEZHAN_PLAY_SELECT_MAX_COUNT = XUEZHAN_PLAY_SELECT_MAX_COUNT

M.NORMAL_TABLE_TYPE_NEW_ZHAJINHUA = NORMAL_TABLE_TYPE_NEW_ZHAJINHUA
M.GAME_TYPE_FRIEND_ZJH = GAME_TYPE_FRIEND_ZJH
M.GAME_TYPE_HONGHEIDAZHAN_ZJH = GAME_TYPE_HONGHEIDAZHAN_ZJH
M.GAME_TYPE_BR_NN = GAME_TYPE_BR_NN
M.GAME_TYPE_ORDINARY_ROOM_NN = GAME_TYPE_ORDINARY_ROOM_NN
M.GAME_TYPE_KPQZ_NN = GAME_TYPE_KPQZ_NN
M.GAME_TYPE_DDZ_NORMAL = GAME_TYPE_DDZ_NORMAL
M.IS_TABLE_RANDOM = IS_TABLE_RANDOM
M.GAME_TYPE_LFDJ = GAME_TYPE_LFDJ
M.GAME_TYPE_ZJH = GAME_TYPE_ZJH
M.GAME_TYPE_TIGER = GAME_TYPE_TIGER
M.GAME_TYPE_FISHING = GAME_TYPE_FISHING
M.GAME_TYPE_TEN_BR_NN = GAME_TYPE_TEN_BR_NN
M.GAME_TYPE_BCBM = GAME_TYPE_BCBM
M.GAME_TYPE_BAIJIALE = GAME_TYPE_BAIJIALE
M.GAME_TYPE_HONGBAO = GAME_TYPE_HONGBAO
M.GAME_TYPE_ERBAGANG = GAME_TYPE_ERBAGANG

-------------------------------------------------------------新框架-------------------------------------------
local table_name_map = {	 
	--[GAME_TYPE_DDZ_COMPETITION] = {hanler_name = 'ddz_handler', room_name  = 'competition_ddz_room'},
	--[GAME_TYPE_DDZ_NORMAL] = {hanler_name = 'ddz_handler',room_name = 'match_ddz_room'},
}

M.table_name_map = table_name_map

return M
